<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<meta charset="UTF-8">
	<table id="taskGrid" data-type="grid" title="" style="height: 300px"
		data-defs="
				method:'post',url: '${rc.contextPath}/activiti/getActiveTasksByUid.do',idField:'taskId',
				rownumbers:true, pagination:false, pageSize:30, singleSelect:true,border:false,
				fitColumns:true, fit:true">
		<thead>
			<tr>
				<!-- 流程定义id -->
				<th data-defs="field:'pdid',hidden:'true'">流程定义ID</th>
				<!-- 流程实例ID -->
				<th data-defs="field:'piid',hidden:'true'">流程实例ID</th>
				<!-- 任务名称 -->
				<th data-defs="field:'taskName',width:200">#springMessage("actTaskName")</th>
				<!-- 发起时间 -->
				<th data-defs="field:'taskCreateDate',width:200,formatter:dateFormatter">#springMessage("actTaskDate")</th>
				<!-- 操作 -->
				<!-- 跳转到任务处理页面的url -->
				<th data-defs="field:'handleTaskUrl',width:200,formatter:formatRowOptions">操作</th>
			</tr>
		</thead>
	</table>
	<script type="text/javascript">
        function formatRowOptions(v, row) {
            var handleTaskUrl = row.handleTaskUrl + "?&taskId=" + row.taskId + "&piid=" + row.piid;
            return '<a href="#" onclick="toHandleTaskPage(\'' + handleTaskUrl
                    + '\')">处理</a> <a href="#" onclick="toViewTaskPage(\'' + row.pdid + '\',\'' + row.piid + '\')">查看</a>';
        }
        function toHandleTaskPage(handleTaskUrl) {
            ajaxLoading();
            //可以自己加类似于panel的loading标志
            var url = "${rc.contextPath}" + handleTaskUrl;
            $("#demoIframe").attr("src", url);
        }
        function toViewTaskPage(pdid, piid) {
            ajaxLoading();
            //可以自己加类似于panel的loading标志
            var url = "${rc.contextPath}/activiti/toActivitiDiagram.do?pdid=" + pdid + "&piid=" + piid;
            $("#demoIframe").attr("src", url);
        }
    </script>